##cmake_minimum_required( VERSION 2.8 )
project("konkordo database connector library")
find_package( Qt4 REQUIRED )

ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)

include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${QT_QTSQL_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ../../interfaces
)


set( HEADERS
    dbconnector_mysql.h
    worker.h
)

set( SOURCES
    dbconnector_mysql.cpp
    worker.cpp
)

qt4_wrap_cpp(MOC ${HEADERS})

add_library(dbconnector_mysql SHARED ${SOURCES} ${MOC} ${UIS_H} )

target_link_libraries(dbconnector_mysql ${QT_LIBRARIES} ${QT_QTSQL_LIBRARY})

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
        set(rootdir ${CMAKE_INSTALL_PREFIX})
        set(libdir ${rootdir}/lib/knkd)
        install(TARGETS dbconnector_mysql DESTINATION ${libdir})
endif()

# install for mac
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
        set(rootdir ${CMAKE_INSTALL_PREFIX})
        set(libdir ${rootdir}/lib/knkd)
        install(TARGETS dbconnector_mysql DESTINATION ${libdir})
endif()
